export default function $http(options) {
	return new Promise((reolve, reject) => {
		if (!options.data) {
			options.data = {}
		}
		let token = uni.getStorageSync('uni_id_token')
		uniCloud.callFunction({
			name: 'mock-router',
			data: {
				action: options.action || '',
				token: token || '',
				data: options.data
			},
			success(e) {
				if (e.result.code === 0) {
					reolve(e.result)
				} else {
					reject(e.result)
				}
			},
			fail(e) {
				uni.showModal({
					content: JSON.stringify(e), 
					showCancel: false
				})
			}
		})
	})
}
